<?php

$par = array();

if (!empty($_SERVER['QUERY_STRING'])) {
	$par = decode_params();
}

if (!isset($errorMsg) && !empty($par['errorMsg'])) {
	$errorMsg = $par['errorMsg'];
}

$data = list_reseller_plans($id,'array');

if(isset($data) && is_array($data)) {
	while (list($k, $v) = each($data)) {
  	$buff = explode("|",$v[d]);
    $v[d] = $buff;

    if ($v['has_domain'] != 'false') {
			$domain_box = '1';
			$domain_menu = '1';
    }

    if ($v['offering'] == 'true') {
			$hosting .= $v[plan];
		}
    
		$v['description'] = explode("|",$v[description]);
    $template['plans'][$k] = $v;
	}
}

$return_url = $_GET['return_url'];

$info1 = list_details($id, 'array');
$info1 = $info1[0];
$info = array_merge($info1, $info2);

$info['fname'] = $info['firstname'];
$info['lname'] = $info['lastname'];

while(list($k, $v) = each($info)) {
	if(empty($$k)) {
		$$k = $v;
	}
}

?>
<table align="center" width="580" class="border" cellspacing="0">
	<tr> 
		<td valign="top" align="middle"> 
			<table>
				<tr> 
					<td  valign=top align=left> 
      			<?php if($errorMsg) { echo "<center><b><font color=red>$errorMsg</font><b></center>"; $errorMsg = ''; } ?>
          </td>
        </tr>
      </table>

      <table width="568">
        <tr> 
          <td colspan="2"> 
          	<p><font class="text"><? echo translate('man_order'); ?></font></p>
          </td>
        </tr>
      </table>
      <?php
      
      //$_GET[s] = 'kalcho_2';
      
      // sve
      $resellername = get_reseller_name_by_id($id);
      $_GET['s'] = $resellername."_2";
      $_GET['plan'] = $plan;
			$_GET['sid'] = $sid;
			$_GET['thankyou_url'] = $baseURL.'//?sid='.$sid;
      $_GET['sld'] = $sld;
      $_GET['tld'] = $tld;
      $_GET['price_type'] = 'wholesale';
      $_GET['price_type_validate'] = base64_encode(crypt('wholesale'.$price_type_secret));
      // wallet
      $_GET['set_wallet'] = 'y';
      $_GET['lang'] = $_SESSION[lang];
      $_GET['from_rp'] = 'y';
      
      //$_GET[return_url] = 'http://hiena.neon.bastun.net/no/wildnic/'; //Change this! This  is the url of your order page
      // sve
			eval("\$_GET[return_url] = \"$returnURL_rp_wp\";");

      // patch
      $_GET['company_name'] = $_GET['company'];
      
      // Patch for autofill of the fields
			$_GET = array_merge($info, $_GET);
        
      $order_url = $order_wpURL; //'https://payments.duoservers.com/order/order_wp_2h.html?';// Don't change this! This is the url where the order form is loaded from
      
      foreach ($_GET as $k => $v) {
      	$order_url.="&$k=".urlencode($v);
      }
      
      include($order_url);
      
      ?>
		</td>
	</tr>
</table>
